package demo3;

import java.io.*;

/**
 * @author 24岁没牵过女人的手 日期：2023/7/6 16:32 文件描述：
 */
public class LowerCaseInputStream extends FilterInputStream {

    public LowerCaseInputStream(InputStream in) throws FileNotFoundException {
        super(in);
    }

    public int read() throws IOException {
        int c = super.read();
        return (c == -1 ? c : Character.toLowerCase((char) c));
    }

    public int read(byte[] b, int offset, int len) throws IOException {
        int res = super.read(b, offset, len);
        for(int i = offset; i < offset+res; i++) {
            b[i] = (byte) Character.toLowerCase((char) b[i]);
        }
        return res;
    }
}
